{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "royal-constitutional",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2021-05-06 21:00:37,749 [open_context_base.py] _socket_reconnect_and_wait_ready:255: Start connecting: host=127.0.0.1; port=11111;\n",
      "2021-05-06 21:00:37,752 [open_context_base.py] on_connected:344: Connected : conn_id=1; \n",
      "2021-05-06 21:00:37,846 [open_context_base.py] _handle_init_connect:445: InitConnect ok: conn_id=1; info={'server_version': 500, 'login_user_id': 716900, 'conn_id': 6796056095533071480, 'conn_key': '49BC94B05D932085', 'conn_iv': '63283578014EC777', 'keep_alive_interval': 10, 'is_encrypt': False};\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(0,                acc_id   trd_env acc_type          card_num   security_firm  \\\n",
      "0  281756455983050852      REAL   MARGIN  1001100100716900  FUTUSECURITIES   \n",
      "1             1905530  SIMULATE     CASH                               N/A   \n",
      "2             4410980  SIMULATE     CASH                               N/A   \n",
      "\n",
      "  sim_acc_type  \n",
      "0          N/A  \n",
      "1        STOCK  \n",
      "2       OPTION  )\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2021-05-06 21:00:37,924 [network_manager.py] work:366: Close: conn_id=1\n"
     ]
    }
   ],
   "source": [
    "from futu import *\n",
    "trd_ctx = OpenHKTradeContext(host='127.0.0.1', port=11111)\n",
    "print(trd_ctx.get_acc_list())\n",
    "trd_ctx.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "ahead-scout",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2021-05-06 21:01:23,615 [open_context_base.py] _socket_reconnect_and_wait_ready:255: Start connecting: host=127.0.0.1; port=11111;\n",
      "2021-05-06 21:01:23,618 [open_context_base.py] on_connected:344: Connected : conn_id=2; \n",
      "2021-05-06 21:01:23,622 [open_context_base.py] _handle_init_connect:445: InitConnect ok: conn_id=2; info={'server_version': 500, 'login_user_id': 716900, 'conn_id': 6796056287759506969, 'conn_key': 'A9AADAB05D93841F', 'conn_iv': 'F5DB2EEE274E6741', 'keep_alive_interval': 10, 'is_encrypt': False};\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "(0,                acc_id   trd_env acc_type          card_num   security_firm  \\\n",
      "0  281756460278018148      REAL   MARGIN  1001100200716900  FUTUSECURITIES   \n",
      "1             4410978  SIMULATE     CASH                               N/A   \n",
      "2             4410981  SIMULATE     CASH                               N/A   \n",
      "\n",
      "  sim_acc_type  \n",
      "0          N/A  \n",
      "1        STOCK  \n",
      "2       OPTION  )\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "2021-05-06 21:01:23,639 [network_manager.py] work:366: Close: conn_id=2\n"
     ]
    }
   ],
   "source": [
    "\n",
    "trd_ctxus = OpenUSTradeContext(host='127.0.0.1', port=11111)\n",
    "print(trd_ctxus.get_acc_list())\n",
    "trd_ctxus.close()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "fixed-brooks",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
